# Maintainer: Jeroen Ooms <jeroen@berkeley.edu>

_realname=argtable
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.13
intver=${pkgver//./-}
pkgrel=1
pkgdesc="ANSI C library for parsing GNU-style command-line options (mingw-w64)"
arch=('any')
license=("custom")
url="https://argtable.sourceforge.io"
source=("https://downloads.sourceforge.net/project/argtable/argtable/${_realname}-${pkgver}/${_realname}${intver}.tar.gz")
sha256sums=('8f77e8a7ced5301af6e22f47302fdbc3b1ff41f2b83c43c77ae5ca041771ddbf')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")

options=('staticlibs' 'strip')

build() {
  [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  mkdir -p ${srcdir}/build-${MINGW_CHOST} && cd ${srcdir}/build-${MINGW_CHOST}
  ../${_realname}${intver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-static \
    --enable-shared

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
